import 'package:flutter/material.dart';

import 'package:get/get.dart';

import 'splash_controller.dart';

class SplashView extends GetView<SplashController> {
  // final splashController = Get.find<SplashController>();
  @override
  Widget build(BuildContext context) {
    // final c = Get.put(SplashController());
    // print(controller.targetPage);
    return Scaffold(
      body: Container(
        width: double.infinity,
        height: double.infinity,
        decoration: BoxDecoration(
          image: DecorationImage(
            image: AssetImage('assets/images/splash_screen.png'),
            fit: BoxFit.cover,
          ),
        ),
        // 2. 遮罩层
        child: Container(
          decoration: BoxDecoration(
            gradient: LinearGradient(
              colors: [
                Color.fromRGBO(0, 0, 0, 0.3),
                Color.fromRGBO(0, 0, 0, 0.4),
              ],
              begin: FractionalOffset.topCenter,
              end: FractionalOffset.bottomCenter,
            ),
          ),
          // 3. Element
          child: Column(
            // 垂直方向居中
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              const SizedBox(height: 40),
              Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: <Widget>[
                  OutlinedButton(
                    child: Obx(
                      () => Text('跳过 ${controller.countDown}',
                          style: TextStyle(
                            color: Colors.black,
                            fontSize: 12,
                            fontWeight: FontWeight.w400,
                            letterSpacing: 2.0,
                          )),
                    ),
                    style: ButtonStyle(
                      backgroundColor: MaterialStateProperty.all<Color>(
                        Colors.blueGrey[200],
                      ),
                    ),
                    onPressed: () {
                      Get.offNamed('/home');
                    },
                  ),
                  const SizedBox(width: 25),
                ],
              ),
              // const Spacer(),
              const SizedBox(height: 60),
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Image.network(
                    'https://s02.mifile.cn/assets/static/image/logo-mi2.png',
                    height: 35,
                  ),
                  Padding(
                    padding: EdgeInsets.only(
                      left: 17,
                      top: 0,
                    ),
                    child: Text(
                      'App',
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 32,
                        fontWeight: FontWeight.w300,
                        letterSpacing: 3.9,
                      ),
                    ),
                  ),
                ],
              ),
              const SizedBox(height: 15),
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Container(
                    margin: EdgeInsets.only(left: 10, right: 10),
                    height: 0.5,
                    width: 50,
                    color: Colors.white,
                  ),
                  Text(
                    'A application.',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 25,
                      fontWeight: FontWeight.w300,
                      letterSpacing: 3.9,
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.only(left: 10, right: 10),
                    height: 0.5,
                    width: 50,
                    color: Colors.white,
                  ),
                ],
              ),
              const Spacer(),
            ],
          ),
        ),
      ),
    );
  }
}
